import pymongo

conn = pymongo.MongoClient()

db = conn['wyh']

col = db['student']

res = col.insert({'name':'胡歌','age':18,'hobbies':'cooking'})
col.update({'name':'胡歌'},{'$set':{'hobbies':'drinking'}})
# col.delete_many({'name':'胡歌'})
res4 =col.find()
for r in res4:
    print(r)

# res1 =col.find()
# print(res1)
# for i in res1:
#     print(i)

# res = col.insert_many([
#     {'name':'瑞文1','age':18},
#     {'name':'瑞文2','age':28},
#     {'name':'瑞文3','age':38},
#     {'name':'瑞文4','age':48}
# ])
# res1 = col.find()
# for i in res1:
#     print(i)
#
# col.update_one({'name':'瑞文'},{'$set':{'age':100}})

# col.remove({'name':'瑞文'})

